package com.example.broadcasttutital.boradcast;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.util.Log;
import android.widget.Toast;

public class BatteryReceiver extends BroadcastReceiver {
    @Override
    public void onReceive(Context context, Intent intent) {
        int level = intent.getIntExtra("level",0);
        Toast.makeText(context, "剩余电量：" + level, Toast.LENGTH_SHORT).show();
    }
}